package hu.monitor.remoting;

import java.util.Iterator;
import java.util.List;

public class InterceptorChain {
	private final List<? extends InvokerInterceptor> interceptors;

	public InterceptorChain(final List<? extends InvokerInterceptor> interceptors) {
		this.interceptors = interceptors;
	}

	public Object processInvocation(final InvocationContext invocationContext) throws Throwable {
		final Iterator<? extends InvokerInterceptor> iterator = this.interceptors.iterator();
		invocationContext.setInterceptorIterator(iterator);
		return invocationContext.invoke();
	}

}
